package com.android.fragmentdemo.adapters
import com.android.fragmentdemo.databinding.RvSpanDynamicLayoutBinding
import com.android.fragmentdemo.databinding.RvSpanHeaderLayoutBinding
import com.hengfoxwolf.commonbase.base.adapter.BaseRvWithHeaderAdapter

class HeaderSpanBodyRVAdapter(headContent: String) :
    BaseRvWithHeaderAdapter<String, RvSpanHeaderLayoutBinding, RvSpanDynamicLayoutBinding>(
        RvSpanHeaderLayoutBinding::inflate,
        RvSpanDynamicLayoutBinding::inflate
    ) {

    private val mHeadContent = headContent

    override fun bindHeaderData(holder: ViewHolder, position: Int) {
        (holder.binding as? RvSpanHeaderLayoutBinding)?.apply {
            itemSpanTitleTv.text = mHeadContent
        }
    }

    override fun bindData(holder: ViewHolder, dataItem: String, position: Int) {
        (holder.binding as? RvSpanDynamicLayoutBinding)?.apply {
            itemDySpan.text = dataItem
        }
    }
}